package com.leyou.auth.web;

import com.leyou.auth.service.ClientService;
import feign.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/client")
public class ClientController {

    @Autowired
    private ClientService clientService;

    /**
     *申请密匙
     * @param clientId  微服务id
     * @param secret  微服务密匙
     * @return String
     */
    @GetMapping("/key")
    public ResponseEntity<String> getSecretKey(@RequestParam("clientId") String clientId,
                                             @RequestParam("secret") String secret){
        return ResponseEntity.ok(clientService.getSecretKey(clientId,secret));
    }

}
